onEvent('fluid.tags', event => {
    event.get('forge:refined_fuel').add('thermal:refined_fuel');
    event.get('forge:ethanol').add('immersiveengineering:ethanol')
    event.get('forge:ethanol').add('pneumaticcraft:ethanol')
});


onEvent('recipes', (event) => {


    //热解炉
    event.custom({
        "type": "thermal:pyrolyzer",
        "ingredient": { "item": 'quark:orange_crystal' },
        "result": [{ "item": 'kubejs:stibium_dust' }],
        "energy": 400,
        "experience": 1
    });

    event.custom({
        "type": "thermal:pyrolyzer",
        "ingredient": { "item": 'minecraft:cobblestone' },
        "result": [{ "item": 'minecraft:blackstone' }],
        "energy": 400,
        "experience": 1
    });

    let pyrolyzer_list = [
        {
            input: 'minecraft:potato',
            fluidcount: 160,
        },
        {
            input: 'minecraft:carrot',
            fluidcount: 160,
        },
        {
            input: 'mekanism:bio_fuel',
            fluidcount: 80,
        }
    ]
    //{"fluid":"thermal:creosote","amount":125}

    pyrolyzer_list.forEach(item => {
        event.custom({
            "type": "thermal:pyrolyzer",
            "ingredient": { "item": item.input },
            "result": [{ "item": 'mekanism:dust_charcoal' }, { "fluid": 'immersiveengineering:ethanol', "amount": item.fluidcount }],
            "energy": 100,
            "experience": 1
        })
    });



    /**
     * "mekanism:evaporating/brine":{"recipe":{"type":"mekanism:evaporating","input":{"amount":10,"tag":"minecraft:water"},"output":{"fluid":"mekanism:brine","amount":1}}},
     */
    event.custom({
        "type": "mekanism:evaporating",
        "input": { "amount": 100, "tag": 'forge:ethanol' },
        "output": { "fluid": 'kubejs:diethyl_ether', "amount": 90 }
    });

    event.custom({
        "type": "mekanism:evaporating",
        "input": { "amount": 100, "tag": "minecraft:water" },
        "output": { "fluid": "mekanism:brine", "amount": 50 }
    });
    // event.custom({
    //     "type": "mekanism:evaporating",
    //     "input": { "amount": 100, "fluid": 'immersiveengineering:ethanol' },
    //     "output": { "fluid": 'kubejs:diethyl_ether', "amount": 90 }
    // });
    event.custom({
        "type": "mekanism:evaporating",
        "input": { "amount": 100, "fluid": 'kubejs:diethyl_ether' },
        "output": { "fluid": 'mekanism:ethene', "amount": 90 }
    });

    //聚氯乙烯片
    event.custom({
        "type": "mekanism:reaction",
        "itemInput": { "ingredient": { "item": "mekanism:substrate" } },
        "fluidInput": { "amount": 50, "tag": "forge:ethene" },
        "gasInput": { "amount": 10, "gas": 'mekanism:chlorine' },
        "energyRequired": 1000, "duration": 60,
        "itemOutput": { "item": "mekanism:hdpe_pellet" },
        "inputs": [{ "item": "mekanism:substrate" }],
        "outputs": [{ "item": "mekanism:hdpe_pellet", "count": 1 }]
    })

    //删除基片产的乙烯
    event.custom({
        "type": "mekanism:reaction",
        "itemInput": { "amount": 2, "ingredient": { "tag": "forge:fuels/bio" } },
        "fluidInput": { "amount": 10, "tag": "minecraft:water" },
        "gasInput": { "amount": 100, "gas": "mekanism:hydrogen" },
        "duration": 100, "itemOutput": { "item": "mekanism:substrate" },
        "inputs": [{ "ingredient": { "tag": "forge:fuels/bio" }, "amount": 2 }],
        "outputs": [{ "item": "mekanism:substrate", "count": 1 }]
    });



    event.custom({
        "type": "immersivepetroleum:distillation",
        "byproducts": [{ "item": "pneumaticcraft:glycerol", "chance": "0.07" }],
        "results": [
            { "fluid": 'immersiveengineering:ethanol', "amount": 50 },
            { "fluid": 'kubejs:diethyl_ether', "amount": 100 },
            { "fluid": 'mekanism:ethene', "amount": 350 }
        ],
        "input": { "tag": 'forge:refined_fuel', "amount": 500 },
        "time": 1,
        "energy": 2048,
    });

    //酵母
    event.custom({
        "type": "pneumaticcraft:thermo_plant",
        "item_input": { "item": 'minecraft:nether_wart' },
        "fluid_input": {
            "type": "pneumaticcraft:fluid",
            "fluid": "minecraft:water", "amount": 1000
        },
        "fluid_output": { "fluid": "pneumaticcraft:yeast_culture", "amount": 800 },
        "temperature": { "min_temp": 303, "max_temp": 333 }, "speed": 0.1, "exothermic": false
    });

    //氟锑酸

    event.custom({
        "type": "mekanism:reaction",
        "itemInput": { "amount": 1, "ingredient": { "item": 'kubejs:hydrogen_peroxide' } },
        "fluidInput": { "amount": 1000, "fluid": 'kubejs:antimony_pentachloride' },
        "gasInput": { "amount": 1000, "gas": 'mekanism:hydrofluoric_acid' },
        "duration": 10,
        "inputs": [{ "ingredient": { "item": 'kubejs:hydrogen_peroxide' }, "amount": 1 }],
        "gasOutput": { "amount": 2000, "gas": 'mekanism:uranium_oxide' },
    });


    /**
     * "mekanism:chemical_infusing/hydrogen_chloride":{"recipe":{
     * "type":"mekanism:chemical_infusing",
     * "leftInput":{"amount":1,"gas":"mekanism:hydrogen"},
     * "rightInput":{"amount":1,"gas":"mekanism:chlorine"},
     * "output":{"gas":"mekanism:hydrogen_chloride","amount":1}}}
     */

    event.custom({
        "type": "mekanism:reaction",
        "itemInput": { "amount": 1, "ingredient": { "item": 'kubejs:hydrogen_peroxide' } },
        "fluidInput": { "amount": 5000, "fluid": 'tconstruct:molten_uranium' },
        "gasInput": { "amount": 2000, "gas": "mekanism:uranium_oxide" },
        "duration": 10,
        "inputs": [{ "ingredient": { "item": 'kubejs:hydrogen_peroxide' }, "amount": 1 }],
        "gasOutput": { "amount": 8000, "gas": 'mekanism:sulfur_dioxide' },
    });

    event.custom({
        "type": "mekanism:reaction",
        "itemInput": { "amount": 1, "ingredient": { "item": 'kubejs:hydrogen_peroxide' } },
        "fluidInput": { "amount": 50, "fluid": 'kubejs:p507' },
        "gasInput": { "amount": 2000, "gas": 'mekanism:sulfur_dioxide' },
        "duration": 10,
        "inputs": [{ "ingredient": { "item": 'kubejs:hydrogen_peroxide' }, "amount": 1 }],
        "gasOutput": { "amount": 2000, "gas": 'mekanism:fissile_fuel' },
    });



    event.custom({
        "type": "mekanism:reaction",
        "itemInput": { "amount": 1, "ingredient": { "item": 'draconicevolution:draconium_dust' } },
        "fluidInput": { "amount": 8000, "fluid": 'minecraft:water' },
        "gasInput": { "amount": 100, "gas": 'mekanism:oxygen' },
        "duration": 10,
        "inputs": [{ "ingredient": { "item": 'draconicevolution:draconium_dust' }, "amount": 1 }],
        "gasOutput": { "amount": 10000, "gas": 'mekanism:uranium_hexafluoride' },
    });


    //"tag":"forge:experience" 气态经验?



    //锑粉
    event.custom({
        "type": "pneumaticcraft:thermo_plant",
        "item_input": { "item": 'quark:orange_crystal' },
        "fluid_input": {
            "type": "pneumaticcraft:fluid",
            "fluid": 'pneumaticcraft:etching_acid', "amount": 100
        },
        "item_output": { "item": 'kubejs:stibium_dust' },
        "temperature": { "min_temp": 503, "max_temp": 1033 }, "speed": 1, "exothermic": false
    });

    //焊锡
    event.custom({
        "type": "pneumaticcraft:thermo_plant",
        "item_input": { "item": 'kubejs:stibium_dust' },
        "fluid_input": {
            "type": "pneumaticcraft:fluid",
            "fluid": 'tconstruct:molten_tin', "amount": 864
        },
        "fluid_output": { "fluid": 'kubejs:soldering_tin', "amount": 500 },
        "temperature": { "min_temp": 0, "max_temp": 1033 }, "speed": 1, "exothermic": false
    });

    //硅岩
    event.custom({
        "type": "mekanism:rotary",
        "fluidInput": { "amount": 1, "fluid": "mekanismmatter:liquid_naquadah" },
        "gasOutput": { "gas": "kubejs:test_gas1", "amount": 10 },

        "fluidOutput": { "amount": 1, "fluid": "mekanismmatter:liquid_naquadah" },
        "gasInput": { "gas": "kubejs:test_gas1", "amount": 10 },
    })

    event.custom({
        "type": "mekanism:crystallizing",
        "chemicalType": "gas",
        "input": { "amount": 2880, "gas": "kubejs:test_gas" },
        "output": { "item": '20x mekanismmatter:trinium_ingot' },
        "outputs": [{ "item": 'mekanismmatter:trinium_ingot', "count": 20 }]
    });

    event.custom({
        "type": "mekanism:crystallizing",
        "chemicalType": "gas",
        "input": { "amount": 144, "gas": "kubejs:test_gas1" },
        "output": { "item": 'mekanismmatter:naquadah' },
        "outputs": [{ "item": 'mekanismmatter:naquadah', "count": 1 }]
    });

    //宇宙物质
    // event.custom({
    //     "type": "mekanism:crystallizing",
    //     "chemicalType": "gas",
    //     "input": { "amount": 144, "gas": "kubejs:test_gas2" },
    //     "output": { "item": 'mekanismmatter:universal_matter' },
    //     "outputs": [{ "item": 'mekanismmatter:universal_matter', "count": 1 }]
    // });



    //UU    
    event.custom({
        "type": "mekanism:rotary",
        "fluidInput": { "amount": 1, "fluid": 'kubejs:uu_substance' },
        "gasOutput": { "gas": "kubejs:test_gas2", "amount": 1 },

        "fluidOutput": { "amount": 1, "fluid": 'kubejs:uu_substance' },
        "gasInput": { "gas": "kubejs:test_gas2", "amount": 1 },
    })

    //传送核心
    event.custom({
        "type": "mekanism:reaction",
        "itemInput": { "amount": 2, "ingredient": { "item": 'minecraft:ender_eye' } },
        "fluidInput": { "amount": 10, "tag": "forge:experience" },
        "gasInput": { "amount": 100, "gas": "mekanism:oxygen" },
        "duration": 100, "itemOutput": { "item": 'mekanism:teleportation_core' },
        "inputs": [{ "ingredient": { "item": 'minecraft:ender_eye' }, "amount": 2 }],
        "outputs": [{ "item": 'mekanism:teleportation_core', "count": 1 }]
    });


    event.recipes.custommachinery.custom_machine("custommachinery:pollution_purifier", 20000)
        .requireItem('mekanismmatter:universal_matter')
        .giveEffectEachTick("huahuamagicconverter:complete_resistance", 100, 50)
        .runCommandOnStart("/mek radiation removeAll", false);


    let list = [
        {
            block: 'astralsorcery:starmetal',
            filud: 'astralsorcery:liquid_starlight',
            output: 'astralsorcery:marble_raw'
        },
        {
            block: 'elementalcraft:inertcrystal_block',
            filud: 'kubejs:tectonic_petrotheum',
            output: 'elementalcraft:whiterock'
        },
        {
            block: 'minecraft:sand',
            filud: 'astralsorcery:liquid_starlight',
            output: 'minecraft:sand'
        },
        {
            block: 'minecraft:soul_sand',
            filud: 'kubejs:tectonic_petrotheum',
            output: 'forbidden_arcanus:soul'
        },
        {
            block: 'mob_grinding_utils:saw',
            filud: 'mob_grinding_utils:fluid_xp',
            output: 'ars_nouveau:experience_gem'
        }
    ]

    /**
   * "thermal:devices/rock_gen/rock_gen_stone":{"recipe":{
   * "type":"thermal:rock_gen",
   * "adjacent":"minecraft:water", //水
   * "below":"minecraft:magma_block", //岩浆块
   * "result":{"item":"minecraft:stone"}}, //输出
   * "outputs":[{"item":"minecraft:stone","count":1}]},
   * 
   * 
   * 
   * 
   */


    list.forEach(item => {
        event.custom({
            "type": "thermal:rock_gen",
            "adjacent": item.filud,
            "below": item.block,
            "result": { "item": item.output },
            "outputs": [{ "item": item.output, "count": 1 }]
        });
    })

    event.custom({
        "type": "mekanism:injecting",
        "itemInput": { "ingredient": { "tag": "forge:gunpowder" } },
        "gasInput": { "amount": 1, "gas": "mekanism:hydrogen_chloride" },
        "output": { "item": '3x mekanism:dust_sulfur' },
        "inputs": [{ "tag": "forge:gunpowder" }],
        "outputs": [{ "item": "mekanism:dust_sulfur", "count": 10 }]
    })


    let list_hfl = [
        {
            input : "extrastorage:raw_neural_processor",
            output : "3x extrastorage:neural_processor"
        },
        {
            input : "refinedstorage:raw_advanced_processor",
            output : "3x refinedstorage:advanced_processor"
        },
        {

            input : "refinedstorage:raw_improved_processor",
            output : "3x refinedstorage:improved_processor"
        },
        {
            input : "refinedstorage:raw_basic_processor",
            output : "3x refinedstorage:basic_processor"
        }
    ]

    list_hfl.forEach(item => {
        event.custom({
            type: 'mekanism:reaction',
            itemInput: { "ingredient": { "item": item.input } },
            fluidInput: { "amount": 1000, "tag": "forge:experience" },
            gasInput: { "amount": 1000, "gas": "mekanism:plutonium" },
            duration: 100,
            itemOutput: { "item": item.output },
            gasOutput: { "gas": "mekanism:spent_nuclear_waste", "amount": 2000 },
        })


    });


    event.custom({
        type: 'mekanism:reaction',
        itemInput: { "ingredient": { "item": 'mekanism:crystal_uranium' } },
        fluidInput: { "amount": 144, "fluid": 'kubejs:uu_substance' },
        gasInput: { "amount": 1000, "gas": "mekanism:plutonium" },
        duration: 100,
        itemOutput: { "item": 'mekanismmatter:universal_matter' },
    })



    //硫磺
    /**
     * "mekanism:injecting/gunpowder_to_sulfur":{"recipe":{
     * "type":"mekanism:injecting",
     * "itemInput":{"ingredient":{"tag":"forge:gunpowder"}},
     * "gasInput":{"amount":1,"gas":"mekanism:hydrogen_chloride"},
     * "output":{"item":"mekanism:dust_sulfur"}},
     * "inputs":[{"tag":"forge:gunpowder"}],
     * "outputs":[{"item":"mekanism:dust_sulfur","count":1}]}
     */


    /**
     * "mekanism:infusion_conversion/redstone/from_enriched":{"recipe":{
     * "type":"mekanism:infusion_conversion",
     * "input":{"ingredient":{"tag":"mekanism:enriched/redstone"}},
     * "output":{"infuse_type":"mekanism:redstone","amount":80}}}
     */


    /**
     * Item.of('mekanism:creative_fluid_tank', '{mekData:{FluidTanks:[{Tank:0b,stored:{FluidName:"mekanismmatter:liquid_naquadah",Amount:2147483647}}]}}')
     * "mekanism:rotary/uranium_hexafluoride":{"recipe":{
     * "type":"mekanism:rotary",
     * "fluidInput":{"amount":1,"tag":"forge:uranium_hexafluoride"},
     * "gasOutput":{"gas":"mekanism:uranium_hexafluoride","amount":1},
     * "gasInput":{"amount":1,"gas":"mekanism:uranium_hexafluoride"},
     * "fluidOutput":{"fluid":"mekanism:uranium_hexafluoride","amount":1}}}
     */

    // event.recipes.custommachinery.custom_machine("custommachinery:chemical_reactor", 100)
    // .requireItem('draconicevolution:draconium_dust')
    // .requireFluid(Fluid.of('minecraft:water', 10000))
    // .produceFluid(Fluid.of('mekanism:uranium_hexafluoride_bucket', 4000))
    // .requireEnergy(20000)

    /**
     * Item.of('thermal:fluid_cell', '{BlockEntityTag:{TankInv:[{FluidName:"minecraft:empty",Capacity:32000,Tank:0b,Amount:0}]},AS_Amulet_Holder:[I;1295173622,1802719174,-2053461912,-1263784917]}')
     * "immersivepetroleum:distillationtower/oilcracking":{"recipe":{
     * "type":"immersivepetroleum:distillation",
     * "byproducts":[{"item":"immersivepetroleum:bitumen"}],
     * "results":[
     * {"fluid":"immersivepetroleum:lubricant","amount":9},
     * {"fluid":"immersivepetroleum:diesel_sulfur","amount":14},
     * {"fluid":"immersivepetroleum:gasoline","amount":39}],
     * "input":{"tag":"forge:crude_oil","amount":75},
     * "time":1,
     * "energy":2048}},
     */
});